function hide(elem){
	var curDisplay = getStyle(elem, 'display');

	if(curDisplay != 'none')
		elem.$oldDisplay = curDisplay;

	elem.style.display = 'none';
}

function show(elem){
	elem.style.display = elem.$oldDisplay || 'block';
	//elem.style.display = 'block';
}

function setOpacity(elem, level){
	if(elem.filters)
		elem.style.filter = 'alpha(opacity=' + level + ')';
	else
		elem.style.opacity = level / 100;
}

function slideDown(elem){

	var h = fullHeight(elem);

	elem.style.height = '0px';

	show(elem);	

	for(var i=0; i<=100; i+=5){
		(function(){
			var pos = i;

			setTimeout(function(){
				elem.style.height = (pos/100)*h + 'px';
			}, (pos + 1) * 10);
		})();
	}
}

function oldfadeIn(elem){
	setOpacity(elem,0);

	show(elem);

	for(var i=0; i<=100; i+=5){
		(function(){
			var pos = i;

			setTimeout(function(){
				setOpacity(elem, pos);
			}, (pos+1)*10);
		})();
	}
}

function fadeIn(elem, to, speed) {
    setOpacity(elem, 0);

    show(elem);

    for (var i=0; i<=100; i+=5){
		(function(){
        		var opacity = i;
        		
				setTimeout(function(){

					setOpacity(elem, (opacity / 100)*to);

            }, (i+1)*speed );
        })();
    }
}